package com.dek.seckill.common.util;

import org.apache.commons.codec.digest.DigestUtils;

public class MD5Util {

    private static final String SALT = "0a1b2c3d";

    public static String md5(String src) {
        return DigestUtils.md5Hex(src);
    }

    public static String inputPassFormPass(String inputParam) {
        return md5(SALT.charAt(0) + SALT.charAt(2) + inputParam + SALT.charAt(5) + SALT.charAt(7));
    }

    public static String formPassToDBPass(String formPass, String  salt) {
        return md5(salt.charAt(0) + salt.charAt(2) + formPass + salt.charAt(5) + salt.charAt(7));
    }

    public static void main(String[] args) {
        System.out.println(formPassToDBPass(inputPassFormPass("123456"), SALT));
    }

}
